//50%
#include <bits/stdc++.h>

using namespace std;
typedef long long LL;

const int N=1e7;

LL a[N]; 

int main() 
{
	int n;cin>>n;
	if(n==1) 
	{
		cout<<1<<endl;
		return 0;
	}
	
	LL cnt=1,pos=1;a[1]=1;
	LL flag=0;
	while(1)
	{
		pos++;
		for(int i=pos;i>=1;i--)
		{
			cnt++;
			a[i]=a[i]+a[i-1];
			if(a[i]==n)
			{
				flag=1;
				cout<<cnt<<endl;
				break;
			}
		}
		if(flag) break;
	}
	
	return 0;
}
